import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

import 'package:vegeshop/widgets/tester/tester.dart';
import 'package:vegeshop/widgets/config/index.dart';
import 'package:vegeshop/widgets/mine/index.dart';


class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => new _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _curIndex = 0;
  bool loading = true;

  @override
  void initState() {
    super.initState();
    print("initState");    
  }  

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      bottomNavigationBar: new BottomNavigationBar(
        items: [
          
          new BottomNavigationBarItem(
              icon: new Icon(Icons.airplay), label: "首页"),
          new BottomNavigationBarItem(
              icon: new Icon(Icons.assignment), label: "测试"),
          new BottomNavigationBarItem(
              icon: new Icon(Icons.add), label: "我的"),
        ],
        currentIndex: _curIndex,
        type: BottomNavigationBarType.fixed,
        onTap: (index) {
          setState(() {
            _curIndex = index;
          });
        },
      ),
      body: new IndexedStack(
        children: <Widget>[  
           new ConfigPage(),               
          new BuyerPage(),            
          new NewPage(),          
        ],
        index: _curIndex,
      ),
    );
  }
}
